<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.shsh.safemanage.model.User"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.model.Department1"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.DepartmentDao"%>

<%
{
User registerUser = (User) session.getAttribute(Constants.SESSION_REGISTER_USER);
%>
<%
String departTypeStr = request.getParameter(Constants.REQUEST_PARAMETER_DEPARTMENT_TYPE);
int departType = 1;
try {
	departType = Integer.parseInt(departTypeStr);
} catch (Exception e) {
}

DepartmentDao departmentDao = DaoCreator.createDepartmentDao();
List<Department1> depart1List = departmentDao.getDepartment1List(departType);
%>
<select id="depart1ID" onchange="refreshDepart2(this.value);">
	<%
	for (Department1 depart1 : depart1List) {
	%>
	<option value="<%=depart1.getId()%>" <%=(depart1.getId().equals(registerUser.getDepartment1ID())? "selected":"")%>><%=depart1.getDepartmentName()%></option>
	<%
	}
	%>
</select>
<%
}
%>
